﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common.UI.EM.Views;
using SEG.ServiceLogic;
using SEG.Model;
using Common.UI.EM.Views.Interfaces;
using Microsoft.Practices.Composite.Presentation.Commands;
using System.Windows;

namespace SEG.UI.Control.Presenters
{
    public class AdministrarGruposEntityPresentationModel : EntityPresentationModel<AdministrarGruposServiceLogic, Grupo, AdministrarGruposCriteria, AdministrarGruposView>
    {

        public DelegateCommand<object> AsignarPermisosAGrupos { get; set; }

        public AdministrarGruposEntityPresentationModel(IFilterView filterView, IListView listView, IDetailView detailView)
            : base(filterView, listView, detailView)
        {
        }

        private bool CanExecuteAsignarPermisosAGrupos(object arg)
        {
            return true;
        }

        private void ExecuteAsignarPermisosAGrupos(object arg)
        {
            if (this.SelectedEntity != null)
            {
                AsignarPermisosAGrupoController controller = new AsignarPermisosAGrupoController();

                controller.Run(this.SelectedEntity);
            }
        }

        protected override void AddListCustomCommands()
        {
            AsignarPermisosAGrupos = new DelegateCommand<object>(this.ExecuteAsignarPermisosAGrupos, this.CanExecuteAsignarPermisosAGrupos);

            this.AddListCustomCommand(AsignarPermisosAGrupos, "Asignar permisos a grupo");
        }
    }
}

